// import '@babel/polyfill'; //es6转es5 兼容IE api

import Vue from 'vue'
import App from './App'

// vue-ls 本地存储
import '@/utils/vue-ls'

import store from './store'
import router from './router'
import 'admin/styles/index.scss' // global css
import './icons' // icon
import './permission' // permission control

import * as filters from './filters' // global filters
import './directive' //自定义指令

// import Cookies from "js-cookie";
import 'normalize.css/normalize.css' // a modern alternative to CSS resets

// 引入Element
import Element from 'element-ui'
import './styles/element-variables.scss'

import CollapseTransition from 'element-ui/lib/transitions/collapse-transition';
Vue.component(CollapseTransition.name, CollapseTransition)

Vue.use(Element, {
    size: 'mini',
})

// 引入Avue
import Avue from '@smallwei/avue'
import '@smallwei/avue/lib/index.css'

import avueSeting from './avue.setting'

window.avueCrud = avueSeting.curd //表格配置

import 'mavon-editor/dist/css/index.css' //富文本编辑器样式
import mavonEditor from 'mavon-editor'

Vue.use(Avue).use(mavonEditor)
import myUtils from './utils/utils'

Vue.prototype.$u = Vue.prototype.$utils = { ...require('./utils'), ...myUtils }

import scLoading from './utils/element-loading'

Vue.prototype.$scLoading = scLoading

//挂载api
import api from './api'

Vue.prototype.$api = api
console.log('api :>> ', api)
// 挂载工具函数

//注册全局组件
import 'admin/plugins/components.js'

//全局引入mixins
import 'admin/mixins'

//图片预览方法
Vue.prototype.$imgView = (imgList, index) => {
    store.commit('app/SET_STATE', { showImgViewer: true, ImgUrlList: imgList, currentImgViewIndex: index })
}

Object.keys(filters).forEach((key) => {
    Vue.filter(key, filters[key])
})

Vue.config.productionTip = false

window.$app = new Vue({
    el: '#app',
    router,
    store,
    render: (h) => h(App),
})
